home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 4 / Precision Software Applications Silver Collection Volume 4 (1993).iso / stats / chadyn.exe / YHENON.C < prev    next >
C/C++ Source or Header  |  1988-11-28  |  1KB  |  62 lines

  1.  
  2. /******************************* YHENON.C ************************************/
  3. /********************* (C) 1986,7,8 by JAMES A. YORKE ************************/
  4.  
  5.  
  6. #include "yinclud.h"
  7.  
  8.  
  9.  
  10. Henon() {
  11.     int     i;
  12.     int     base;
  13.     double  y_temp[6],
  14.             temp;
  15.  
  16.     if(num_lyap == 0) {
  17.         temp = rho - (*y) * (*y) + C1 * y[1];
  18.         y[1] = *y;
  19.         y[0] = temp;
  20. /*    temp = rho -y[0]*y[0] + C1*y[1];
  21.     y[1] = y[0];
  22.         y[0] = temp;
  23. */
  24.  
  25.     }
  26.     else {
  27.         y_temp[0] = rho - y[0] * y[0] + C1 * y[1];
  28.         y_temp[1] = y[0];
  29.  
  30.         for(i = 0; i < num_lyap; i++) {
  31.             base = lyapzero + vec_dim * i;
  32.             y_temp[base]
  33.                 = -2 * y[0] * y[base]
  34.                 + C1 * y[base + 1];
  35.             y_temp[base + 1]
  36.                 = y[base];
  37.         }
  38.         for(i = 0; i < lyapzero + vec_dim * num_lyap; i++)
  39.             y[i] = y_temp[i];
  40.     }
  41. }
  42.  
  43. initHenon() {
  44.  /* Henon */
  45.     vec_dim = 2;        /* the dimension of the Lyapunov vectors =
  46.                    phase space dim */
  47.     num_lyap = 0;        /* the number of Lyapunov numbers to be
  48.                    computed <=vec_dim */
  49.     lyapzero = 2;        /* y[lyapzero] is the zeroth coord of the
  50.                    zeroth lyapunov vector */
  51.     dim = lyapzero + num_lyap * vec_dim;
  52.  /* needed for rungekutta */
  53.  
  54.     X_upper = 2.0;        /* x scale */
  55.     X_lower = -2.0;
  56.     Y_upper = 2.0;        /* y scale */
  57.     Y_lower = -2.0;
  58.     C1 =.3;
  59.     rho = 1.4;
  60.     map = Henon;
  61. }
  62.